<layout name="layout" />
<style type="text/css">
     .s1 {
          color: red;
         }
    /* .modal {
         position: absolute !important;
         top: 10px !important;
         left: 50% !important;
         width: 500px;
         margin-left: -250px;
         z-index: 1050;
         overflow: visible !important;
         background-color: #fff;
         background-clip: padding-box;
         box-shadow: 0 3px 7px rgba(0,0,0,0.3);
         -webkit-background-clip: padding-box;
         -khtml-background-clip: padding-box;
         -moz-background-clip: padding-box;
         -ms-background-clip: padding-box;
         -o-background-clip: padding-box;
         background-clip: padding-box;
         border-radius: 6px;
         border: 1px solid rgba(0,0,0,0.3);
     }
     .modal-dialog {

         margin: 0px auto !important;
     }*/
    </style>
<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<!--layui1231232-->

<script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Admin/js/layer.js"></script>
<!-- 搜索 -->
<!--<div class="form-div search_form_div ">-->
    <!--<form action="{:U(add_file)}" method="post" enctype="multipart/form-data">-->
        <!--<input type="file" class="btn btn-info" name="import">-->
        <!--<p>-->
        <!--<button type="submit" class="btn btn-info" >提交</button>-->
        <!--</p>-->
    <!--</form>-->
    <!--<a href="__PUBLIC__/upload/demo.xlsx" download="demo.xlsx" class="btn btn-success">模版展示下载</a>-->
<!--</div>-->
<!---->
<div class="modal in" id="uploadExcel" aria-hidden="false" style="display: none; top: 10px">
    <div class="modal-dialog" style="width: 500px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" onclick="$('#uploadExcel').hide()" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">导入Excel</h4>
            </div>
            <form action="{:U(add_file)}" method="post" enctype="multipart/form-data">
                <div class="modal-body">
                    <h4>表格样例</h4>
                    <img src="__PUBLIC__/Admin/examplehuiyuan.jpg" style="width:100%; border:2px solid red; margin-top:1em ; margin-bottom:1em">
                    <h4>请严格按照图示来整理资料，第一列为姓名、第二列为手机号码、第三列为备注内容，其他内容不导入进来， 只支持xls和xlsx格式。</h4>
                    <br>
                    <div class="form-group">
                        <label class="control-label col-lg-2">选择文件：</label>
                        <div class="col-lg-10">
                            <input type="file" class="btn  radius" name="import">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <a href="__PUBLIC__/upload/huiyuandemo.xlsx" download="huiyuandemo.xlsx" class="btn btn-success">模版展示下载</a>
                    <button type="button" class="btn btn-sm btn-default" onclick="$('#uploadExcel').hide()" data-dismiss="modal">关闭</button>
                    <button type="submit" class="btn btn-primary radius" >导入</button>
                </div>

            </form>
        </div>
    </div>
</div>
<!---->
<div class="form-div search_form_div ">
    <form action="__ACTION__" method="GET" name="search_form">
        <p>
			姓名：
	   		<input type="text" name="username" size="30" value="<?php echo I('get.username'); ?>" />
		</p>
		<p>
			手机：
	   		<input type="text" name="telphone" size="30" value="<?php echo I('get.telphone'); ?>" />
		</p>
		<p>
			来源：
	   		<input type="text" name="from" size="30" value="<?php echo I('get.from'); ?>" />
		</p>
		<p>
			<input type="submit" value=" 搜索 " class="button btn btn-info" />
			<button type="button" class="btn btn-info " style="float: right;" id="btn">导出本页会员为表格</button>&nbsp;&nbsp;&nbsp;
            <button type="button" class="btn btn-success "  onclick="$('#uploadExcel').show()" style="float: right;" id="btn">导入数据</button>&nbsp;&nbsp;&nbsp;
		</p>
    </form>

</div>
<!-- 列表 -->
<div class="list-div table2excel" id="listDiv">
    <table style="text-align:center;width:100%;font-size:0.9em;" class="table table-hover table-bordered table-condensed"  id="customerTable">
        <thead>
        <tr class='customer-tr info'>
            <th style='text-align:center;' >编号</th>
            <th style='text-align:center;'>姓名</th>
            <th style='text-align:center;'>性别</th>
            <th style='text-align:center;'>手机</th>
            <th style='text-align:center;'>积分</th>
            <th style='text-align:center;'>级别</th>
            <th style='text-align:center;'>状态</th>
            <th style='text-align:center;'>卡号</th>
            <th style='text-align:center;'>卡项</th>
            <th style='text-align:center;'>选课数</th>
            <th style='text-align:center;'>分类</th>
            <th style='text-align:center;'>专修</th>
            <th style='text-align:center;'>员工</th>
            <th style='text-align:center;'>介绍人</th>
            <th style='text-align:center;'>余额</th>
            <th style='text-align:center;'>折扣</th>
            <th style='text-align:center;'>总次数</th>
            <th style='text-align:center;'>上课次数</th>
            <th style='text-align:center;'>余次</th>
            <th style='text-align:center;'>开始时间</th>
            <th style='text-align:center;'>结束时间</th>
            <th style='text-align:center;'>应付款</th>
            <th style='text-align:center;'>已付</th>
            <th style='text-align:center;'>欠款</th>
            <th style='text-align:center;'>来源</th>
            <th width="120" style='text-align:center;'>操作</th>
        </tr>
        </thead>

		<?php foreach ($data as $k => $v): ?>
			<tr id="member_{:$v['id']}" data-id="{:$v['id']}" class="" >
				<td  height="60"><?php echo $v['code']; ?></td>
				<td><?php echo $v['username']; ?></td>
				<td><?php echo $v['sex']; ?></td>
				<td><?php echo $v['telphone']; ?></td>
				<td><?php echo $v['jifen']; ?></td>
				<td><?php echo $v['level']; ?></td>
				<td><?php echo $v['status']; ?></td>
				<td><?php echo $v['kahao']; ?></td>
				<td><?php getIdByName('card',$v['card_id'],'name'); ?></td>
				<td><?php echo $v['class_count']; ?></td>
				<td><?php echo $v['member_cat']; ?></td>
				<td><?php echo $v['member_hobby']; ?></td>
				<td><?php echo $v['work_man']; ?></td>
				<td><?php echo $v['intro_man']; ?></td>
				<td><?php echo $v['member_account']; ?></td>
				<td><?php echo $v['member_zk']; ?></td>
				<td><?php echo $v['member_count']; ?></td>
				<td><?php echo $v['class_in_count']; ?></td>
				<td><?php echo $v['class_account']; ?></td>
				<td><?php echo $v['start_time']; ?></td>
				<td><?php echo $v['end_time']; ?></td>
				<td><?php echo $v['pay_account']; ?></td>
				<td><?php echo $v['payed']; ?></td>
				<td><?php echo $v['pay_last']; ?></td>
				<td><?php echo $v['from']; ?></td>
		        <td align="center">
		        	<a href="<?php echo U('edit?id='.$v['id'].'&p='.I('get.p')); ?>" title="编辑">编辑</a> |
	                <a href="<?php echo U('delete?id='.$v['id'].'&p='.I('get.p')); ?>" onclick="return confirm('确定要删除吗？');" title="移除">移除</a>
		        </td>
	        </tr>
        <?php endforeach; ?>
		<?php if(preg_match('/\d/', $page)): ?>
        <tr><td align="right" nowrap="true" colspan="99" height="30"><?php echo $page; ?></td></tr>
        <?php endif; ?>
	</table>
</div>


<!--功能操作区-->
<div class="well">
    <div class="btn-toolbar" role="toolbar">
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='points_manage' >加减积分</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='buy_coach' data-toggle="modal" data-target="#buy_coach_div">购买私教</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='fixClassEnrollButton'  data-toggle="modal" data-target="#fixClassEnrollDiv">专修报名</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='set_password' data-toggle="modal" data-target="#set_password_div">消费密码</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='buyHandTag' >衣柜租赁</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='pickCourse' data-toggle="modal" data-target="#pickCourseDiv">会员选课</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='addFollow' data-toggle="modal" data-target="#addFollowDiv">客户跟踪</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='addCardSaving' data-toggle="modal" data-target="#addCardSavingDiv">账户充值</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='owePayBack'  >补缴欠款</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-primary' id='sell_card' onclick='sell_card()'  >	售卡</button>
            <button class='btn btn-xs btn-primary' id='open_card' onclick='open_card()'>	开卡</button>
            <button class='btn btn-xs btn-primary' id='change_card'   >升级</button> <!--onclick='change_card()'-->
            <button class='btn btn-xs btn-primary' id='singleDelay'  onclick="active_yanqi()"  data-toggle='modal' >延期</button>
            <button class='btn btn-xs btn-primary' id='stop_card'   >	停卡</button>
            <button class='btn btn-xs btn-primary' id='active_card' onclick='active_card()' disabled='disabled' >恢复</button>
            <button class='btn btn-xs btn-primary' id='replaceCard' data-toggle='modal' data-target='#replaceCardModal'>补卡</button>
        </div>

        <div class="btn-group">

        </div>

        <div class="btn-group">
            <button class='btn btn-xs btn-danger' id='superChange' >超级修改</button>
        </div>
        <div class="btn-group">
            <button class='btn btn-xs btn-success' id='writeCard' >写卡</button>
        </div>

    </div>

</div>

<ul class="nav nav-tabs" id="myTab">
    <li class="active"><a href="#profile" data-toggle="tab">会员资料</a></li>
    <li class=""><a href="#cardinfo" data-toggle="tab">会员卡</a></li>
    <li class=""><a href="#changecardlist" data-toggle="tab" customerid="369619">升级</a></li>
    <li><a href="#delayList" data-toggle="tab" customerid="369619">延期</a></li>
    <li><a href="#stopcardlist" data-toggle="tab" customerid="369619">停卡/恢复</a></li>
    <li><a href="#replacecardlist" data-toggle="tab" customerid="369619">补卡</a></li>
    <li><a href="#booklist" data-toggle="tab" customerid="369619">预约</a></li>
    <li><a href="#checkinlist" data-toggle="tab" customerid="369619">上课</a></li>
    <li><a href="#cancellist" data-toggle="tab" customerid="369619">取消</a></li>
    <li><a href="#smslist" data-toggle="tab" mobile="13839603536">短信</a></li>
    <li><a href="#pointslist" data-toggle="tab" customerid="369619">积分</a></li>
    <li><a href="#coachcheckinlist" data-toggle="tab" card="600017">私教</a></li>
    <li><a href="#fitChecklist" data-toggle="tab" customerid="369619">出入场</a></li>
    <li><a href="#handTagList" data-toggle="tab" customerid="369619">衣柜</a></li>
    <li><a href="#followList" data-toggle="tab" customerid="369619">跟踪</a></li>
    <li><a href="#pickCourseList" data-toggle="tab" customerid="369619">选课</a></li>
    <li><a href="#addCardSavingList" data-toggle="tab" customerid="369619">充值</a></li>
    <li><a href="#productSellList" data-toggle="tab" customerid="369619">购物</a></li>
    <li><a href="#fixEnrollList" data-toggle="tab" customerid="369619">专修报名</a></li>
    <li><a href="#owePayList" data-toggle="tab" buttonlist="61" customerid="369619">缴款</a></li>
    <li class=""><a href="#cardCourseList" data-toggle="tab" customerid="369619">分类管理</a></li>
    <li><a href="#profileList" data-toggle="tab" customerid="369619">档案</a></li>
</ul>


<!--下面都是隐藏层-->

<!--加减积分隐藏层-->
<div class="modal fade in" id="points_manage_div" style="z-index: 1001; display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" name="close_points_manage">×</button>
                <h4 class="modal-title">加减积分</h4>
            </div>
            <div class="modal-body">
                <input type="text" class="form-control input-sm" name="send_status" style="display:none">
                <form class="form-horizontal" id="points">
                    <input name="member_id" id="member_id" value="" style="display:none">
                    <input type="tel" class="form-control input-sm" name="id" id="pointsId" style="display:none">
                    <div class="form-group">
                        <label class="col-lg-2 control-label">客户姓名</label>
                        <div class="col-lg-10">
                            <input type="text" class="form-control input-sm" name="name" id="pointsName" value="" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="select" class="col-lg-2 control-label">选择方式</label>
                        <div class="col-lg-6">
                            <select class="form-control input-sm" name="type" id="pointsType">
                                <option value="plus">增加</option>
                                <option value="minus">减少</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">积分数额</label>
                        <div class="col-lg-10">
                            <input class="form-control input-sm" name="points_num" value="0" id="pointsNum">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">积分说明</label>
                        <div class="col-lg-10">
                            <textarea class="form-control input-sm" rows="3" name="describe" id="pointsDescribe">			</textarea>
                        </div>
                    </div>
                </form>
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm cancel" data-dismiss="modal" name="close_points_manage">关闭</button>
                <button type="button" class="btn btn-primary btn-sm" id="pointsManageBtn">保存</button>
            </div>

        </div>
    </div>
</div>
<!--充值隐藏层-->
<div class="modal" id="addCardSavingDiv" aria-hidden="true" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                <h4 class="modal-title">账户充值</h4>
            </div>
            <div class="modal-body">
                <input type="text" class="form-control input-sm" name="send_status" style="display:none">
                <form id="addCardSavingForm" class="form-horizontal">
                    <input name="member_id" class="member_id" value="" style="display:none">
                    <input class="form-control input-sm" name="addCardSavingCustomerId" id="addCardSavingCustomerId" style="display:none">
                    <div class="form-group">
                        <label class="col-lg-4 control-label">账户原余额</label>
                        <div class="col-lg-4">
                            <input class="form-control input-sm" id="oldCardSaving" name="oldCardSaving" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="select" class="col-lg-4 control-label">充值数额</label>
                        <div class="col-lg-4">
                            <input class="form-control input-sm" id="addCardSavingNums" name="addCardSavingNums" value="0">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">充值后余额</label>
                        <div class="col-lg-4">
                            <input class="form-control input-sm" id="newCardSaving" name="newCardSaving" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">折扣率</label>
                        <div class="col-lg-4">
                            <input class="form-control input-sm" id="chargeCardDiscount" name="chargeCardDiscount">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">收款金额</label>
                        <div class="col-lg-4">
                            <input class="form-control input-sm" id="fee" name="fee" value="0">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">支付方式</label>
                        <div class="col-lg-4">
                            <select name="payWay" class="form-control input-sm" id="addCardSavingPayWay">
                                <option value="cash">现金</option>
                                <option value="bank">银行卡</option>
                                <option value="alipay">支付宝</option>
                                <option value="wxpay">微信支付</option>
                                <option value="saving">储值</option>
                                <option value="points">积分</option>
                            </select>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">充值员工</label>
                        <div class="col-lg-4">
                            <input class="form-control input-sm" id="" name="worker" value="0">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-4 control-label">备注</label>
                        <div class="col-lg-4">
                            <textarea class="form-control input-sm" rows="2" name="note" id="addCardSavingNote">			</textarea>
                        </div>
                    </div>

                </form></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary btn-sm" id="addCardSavingBtn">保存</button>
            </div>

        </div>
    </div>
</div>
<!--购买私教隐藏层-->
<div class="modal" id="buy_coach_div" aria-hidden="true" style=" display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" name="close_buy_coach">×</button>
                <h4 class="modal-title">购买私教</h4>
            </div>
            <div class="modal-body">
                <form id="buyCoachForm" class="form-horizontal">
                    <input name="offset" value="" style="display:none">
                    <input name="buycoachcustomerid" id="buycoachcustomerid" style="display:none">

                    <div class="form-group">
                        <label class="col-lg-2 control-label ">教练姓名</label>
                        <div class="col-lg-6">
                            <select class="form-control input-sm" id="coachId">
                                <option value="none"></option>
                                <option value="10680">高妍</option>
                                <option value="10681">存景</option>
                                <option value="10682">心念</option>
                                <option value="11381">张丹</option>
                                <option value="11382">雪也</option>
                                <option value="11402">宁芳</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">私教等级</label>
                        <div class="col-lg-6">
                            <select name="coachlevelid" class="form-control input-sm necessery" id="coachlevelid">
                                <option value="none">请选择</option>
                            </select>
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-lg-2 control-label">次数</label>
                        <div class="col-lg-6">
                            <input type="number" class="form-control input-sm necessery" name="buytimes" id="buytimes">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label ">价格</label>
                        <div class="col-lg-6">
                            <input style="display:none" name="cust_id">
                            <input type="number" class="form-control input-sm necessery" name="hourprice" id="hourprice" placeholder="必填">
                        </div>
                    </div>

                    <input type="hidden" class="form-control input-sm" name="buyhours" id="buyhours">

                    <div class="form-group">
                        <label class="col-lg-2 control-label">开始日期</label>
                        <div class="col-lg-6">
                            <input class="form-control input-sm hasDatepicker" name="buyCoachBeginDate" id="buyCoachBeginDate">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">截止日期</label>
                        <div class="col-lg-6">
                            <input class="form-control input-sm hasDatepicker" name="buyCoachEndDate" id="buyCoachEndDate">
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-lg-2 control-label">实收总额</label>
                        <div class="col-lg-6">
                            <input type="number" class="form-control input-sm necessery" name="totalmoney" id="totalmoney"><div id="mobile_duplicate"></div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">支付方式</label>
                        <div class="col-lg-3">
                            <select name="payWay" class="form-control input-sm" id="bcPayWay">
                                <option value="cash">现金</option>
                                <option value="bank">银行卡</option>
                                <option value="alipay">支付宝</option>
                                <option value="wxpay">微信支付</option>
                                <option value="saving">储值</option>
                                <option value="points">积分</option>
                            </select>
                        </div>
                        <div class="col-lg-3" style="padding-left:0;">
                            折扣率<input id="bcdiscount" class="input-sm" style="width:50px" value="1" disabled="">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">销售员工</label>
                        <div class="col-lg-6">
                            <select name="staffid" class="form-control input-sm" id="bcStaffId" style="width:10em;display:inline;">
                                <option value="none">请选择</option>
                                <option value="11402">宁芳</option>
                                <option value="11382">雪也</option>
                                <option value="11381">张丹</option>
                                <option value="10686">陈静</option>
                                <option value="10685">雨秋</option>
                                <option value="10683">露露</option>
                                <option value="10682">心念</option>
                                <option value="10681">存景</option>
                                <option value="10680">高妍</option>
                            </select>
                            <input class="form-control input-sm" style="width:6em;display:inline" id="bcfirstmoney">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">销售员工</label>
                        <div class="col-lg-6">
                            <select name="sellstaffidsecond" class="form-control input-sm" id="sellstaffidsecond" style="width:10em;display:inline;">
                                <option value="none">请选择</option>
                                <option value="11402">宁芳</option>
                                <option value="11382">雪也</option>
                                <option value="11381">张丹</option>
                                <option value="10686">陈静</option>
                                <option value="10685">雨秋</option>
                                <option value="10683">露露</option>
                                <option value="10682">心念</option>
                                <option value="10681">存景</option>
                                <option value="10680">高妍</option>
                            </select>
                            <input class="form-control input-sm" style="width:6em;display:inline" id="bcsecondmoney">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">销售员工</label>
                        <div class="col-lg-6">
                            <select name="sellstaffidthird" class="form-control input-sm" id="sellstaffidthird" style="width:10em;display:inline;">
                                <option value="none">请选择</option>
                                <option value="11402">宁芳</option>
                                <option value="11382">雪也</option>
                                <option value="11381">张丹</option>
                                <option value="10686">陈静</option>
                                <option value="10685">雨秋</option>
                                <option value="10683">露露</option>
                                <option value="10682">心念</option>
                                <option value="10681">存景</option>
                                <option value="10680">高妍</option>
                            </select>
                            <input class="form-control input-sm" style="width:6em;display:inline" id="bcthirdmoney">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">销售日期</label>
                        <div class="col-lg-6">
                            <input class="form-control input-sm" id="buycoachsetdatetime" value="2017-05-01">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">销售备注</label>
                        <div class="col-lg-6">
                            <textarea class="form-control input-sm" name="buyCoachNote" id="buyCoachNote" rows="3"></textarea>
                        </div>
                    </div>
                </form></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal" name="close_buy_coach">关闭</button>
                <button type="button" class="btn btn-primary btn-sm" id="buyCoachBtn">保存</button>
            </div>
        </div>

    </div>
</div>
<!--学生报名隐藏层-->
<div class="modal" id="fixClassEnrollDiv" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" name="closeFixClassEnrollDiv">×</button>
                <h4 class="modal-title">专修报名</h4>
            </div>
            <div class="modal-body">
                <form id="fixClassEnrollForm" class="form-horizontal">
                    <div class="form-group">
                        <input type="text" class="form-control input-sm" id="customerId" name="customerId" style="display:none">
                        <label class="col-lg-2 control-label">报名学生</label>
                        <div class="col-lg-10">
                            <div class="col-lg-3" style="padding:0.3em">
                                <input type="text" class="form-control input-sm" id="customerName" readonly="readonly" placeholder="姓名">
                            </div>
                            <div class="col-lg-3" style="padding:0.3em">
                                <input type="text" class="form-control input-sm" id="customerMobile" readonly="readonly" placeholder="手机">
                            </div>
                            <div class="col-lg-3" style="padding:0.3em">
                                <input type="text" class="form-control input-sm" id="customerCard" readonly="readonly" placeholder="卡号">
                            </div>
                            <div class="col-lg-3" style="padding:0.3em">
                                <input type="text" class="form-control input-sm" id="leftTimes" readonly="readonly" placeholder="剩余次数">
                            </div>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">报名班级</label>
                        <div class="col-lg-10">
                            <select class="form-control input-sm" id="fixClassId" name="fixClassId">
                                <option value="selectPlease">--请选择--</option>
                            </select>
                        </div>
                    </div>



                    <div class="form-group">
                        <label class="col-lg-2 control-label">报名日期</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control input-sm hasDatepicker" id="enrollDate" name="enrollDate" value="2017-05-01">
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-lg-2 control-label">实收金额</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control input-sm" id="enrollPrice" name="enrollPrice">
                        </div>
                    </div>


                    <div class="form-group">
                        <label class="col-lg-2 control-label">报名次数</label>
                        <div class="col-lg-3">
                            <input type="text" class="form-control input-sm necessery" id="enrollTimes" name="enrollTimes" placeholder="大于零的整数">
                        </div>
                        <div class="col-lg-7">
                            <h5>请务必填写报名次数，才会排班</h5>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">支付方式</label>
                        <div class="col-lg-4">
                            <select name="payWay" class="form-control input-sm" id="cfcePayWay">
                                <option value="cash">现金</option>
                                <option value="bank">银行卡</option>
                                <option value="alipay">支付宝</option>
                                <option value="wxpay">微信支付</option>
                                <option value="saving">储值</option>
                                <option value="points">积分</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">销售员工</label>
                        <div class="col-lg-10">
                            <div class="col-lg-3 input-group input-sm" style="float:left;margin-right:1em">
						<span class="input-group-addon input-sm">
						<select id="stStaffId" name="stStaffId">
						  <option value="select_please">请选择</option>
						  						  <option value="11402">
						  宁芳						  </option>
						  						  <option value="11382">
						  雪也						  </option>
						  						  <option value="11381">
						  张丹						  </option>
						  						  <option value="10686">
						  陈静						  </option>
						  						  <option value="10685">
						  雨秋						  </option>
						  						  <option value="10683">
						  露露						  </option>
						  						  <option value="10682">
						  心念						  </option>
						  						  <option value="10681">
						  存景						  </option>
						  						  <option value="10680">
						  高妍						  </option>
						  						</select>
						</span>
                                <input class="form-control input-sm" style="width:63px;z-index:1" name="stStaffMoney" id="cfceStStaffMoney">
                            </div>

                            <div class="col-lg-3 input-group input-sm" style="float:left;margin-right:1em">
						<span class="input-group-addon input-sm">
						<select id="ndStaffId" name="ndStaffId">
						  <option value="select_please">请选择</option>
						  						  <option value="11402">
						  宁芳						  </option>
						  						  <option value="11382">
						  雪也						  </option>
						  						  <option value="11381">
						  张丹						  </option>
						  						  <option value="10686">
						  陈静						  </option>
						  						  <option value="10685">
						  雨秋						  </option>
						  						  <option value="10683">
						  露露						  </option>
						  						  <option value="10682">
						  心念						  </option>
						  						  <option value="10681">
						  存景						  </option>
						  						  <option value="10680">
						  高妍						  </option>
						  						</select>
						</span>
                                <input class="form-control input-sm" style="width:63px;z-index:1" name="ndStaffMoney" id="cfceNdStaffMoney">
                            </div>

                            <div class="col-lg-3 input-group input-sm" style="float:left">
						<span class="input-group-addon input-sm">
						<select id="rdStaffId" name="rdStaffId">
						  <option value="select_please">请选择</option>
						  						  <option value="11402">
						  宁芳						  </option>
						  						  <option value="11382">
						  雪也						  </option>
						  						  <option value="11381">
						  张丹						  </option>
						  						  <option value="10686">
						  陈静						  </option>
						  						  <option value="10685">
						  雨秋						  </option>
						  						  <option value="10683">
						  露露						  </option>
						  						  <option value="10682">
						  心念						  </option>
						  						  <option value="10681">
						  存景						  </option>
						  						  <option value="10680">
						  高妍						  </option>
						  						</select>
						</span>
                                <input class="form-control input-sm" style="width:63px;z-index:1" name="rdstStaffMoney" id="cfceRdstStaffMoney">
                            </div>

                        </div>
                    </div>

                    <div class="form-group">
                        <label for="textArea" class="col-lg-2 control-label">报名备注</label>
                        <div class="col-lg-10">
                            <textarea class="form-control input-sm" rows="3" id="cfceNote" name="note"></textarea>
                        </div>
                    </div>

                </form></div>

            <div class="modal-footer">
                <button type="button" class="btn btn-sm btn-default" name="closeFixClassEnrollDiv">关闭</button>
                <button type="button" class="btn btn-sm btn-primary" id="customerFixClassEnrollBtn">保存</button>
            </div>

        </div>
    </div>
</div>
<!--设定密码隐藏层-->
<div class="modal" id="set_password_div" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" name="close_set_password">×</button>
                <h4 class="modal-title">密码设定</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal">
                    <input name="offset" value="" style="display:none">
                    <input style="display:none" name="cust_id" id="pwCustomerId">

                    <div class="form-group">
                        <label class="col-lg-2 control-label ">设定密码</label>
                        <div class="col-lg-6">
                            <input type="password" class="form-control input-sm" name="password" id="pwPassword">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label ">再次输入</label>
                        <div class="col-lg-6">
                            <input type="password" class="form-control input-sm" name="checkpassword" id="pwCheckpassword">
                        </div>
                        <label class="control-label" name="passworderror" style="color:red"></label>
                    </div>

                </form></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal" name="close_set_password">关闭</button>
                <button type="submit" class="btn btn-primary btn-sm" id="passwordsave">保存</button>
            </div>
        </div>

    </div>
</div>
<!--会员选课隐藏层-->
<div class="modal" id="pickCourseDiv" style="display: none;">
    <div class="modal-dialog" style="width:70%">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" id="closePickCourseDiv">×</button>
                <h4 class="modal-title">会员选课</h4>
            </div>
            <div class="modal-body">
                <div id="pickedCourse"><table class="table table-condensed" id="pickedCourseTable">
                    <caption>已选择的课程(共0节)
                        <button id="addPickCourse" class="btn btn-xs btn-primary" value="369661">新增</button>
                    </caption>
                    <tbody><tr name="pickedCourseRow" class="success">
                        <th>课程名称</th>
                        <th>剩余次数</th>
                        <th>开始日期</th>
                        <th>截止日期</th>
                        <th>选课金额</th>
                        <th>支付方式</th>
                        <th>销售员工</th>
                        <th>登记日期</th>
                        <th>操作</th>
                    </tr>


                    <tr id="newPickedCourseRow">
                        <td>
                            <select id="courseId" class="form-control input-sm">
                                <option></option>
                                <option value="20084">急速瘦身</option>
                                <option value="20085">女性生殖保养（阴瑜伽）</option>
                                <option value="20086">空中瑜伽</option>
                                <option value="20087">阿斯汤伽</option>
                                <option value="20088">平衡瘦身球</option>
                                <option value="20089">传统哈他</option>
                                <option value="20090">舞韵瑜伽</option>
                                <option value="20091">高温瑜珈</option>
                                <option value="20092">精准正位</option>
                                <option value="20093">普拉提</option>
                                <option value="20094">能量流</option>
                                <option value="20095">双人瑜伽</option>
                                <option value="20096">入门瑜伽（零基础）</option>
                                <option value="20097">减肥瑜伽</option>
                                <option value="20098">瑜伽日</option>
                                <option value="20099">传统哈他</option>
                                <option value="20100">新会员说明课</option>
                                <option value="20101">商卡排毒</option>
                                <option value="20102">静心抄经</option>
                                <option value="20103">户外瑜伽</option>
                                <option value="20104">禅坐冥想</option>
                                <option value="20105">艾扬格辅助</option>
                                <option value="20106">儿童瑜伽</option>
                                <option value="20107">青少年瑜伽</option>
                                <option value="20108">男士瑜伽</option>
                                <option value="20109">瑜伽砖辅助课</option>
                                <option value="20110">3D动感瑜伽</option>
                                <option value="20111">拜日练习</option>
                                <option value="20112">肩部打开</option>
                                <option value="20113">髋部灵活</option>
                                <option value="20114">S体型操（本月推荐）</option>
                                <option value="21411">初级流瑜伽</option>
                            </select>
                        </td>
                        <td>
                            <input id="courseNums" class="form-control input-sm">
                        </td>
                        <td>
                            <input id="beginDate" class="form-control input-sm hasDatepicker" value="">
                        </td>
                        <td>
                            <input id="endDate" class="form-control input-sm hasDatepicker" value="">
                        </td>
                        <td>
                            <input id="price" class="form-control input-sm" value="0">
                        </td>
                        <td>
                            <select id="payway" class="form-control input-sm" customerid="369661">
                                <option value="cash">现金</option>
                                <option value="bank">银行卡</option>
                                <option value="alipay">支付宝</option>
                                <option value="wxpay">微信支付</option>
                                <option value="saving">储值</option>
                                <option value="points">积分</option>
                            </select>
                        </td>
                        <td>
                            <select id="staffid" class="form-control input-sm">
                                <option value=""></option>
                                <option value="10680">高妍</option>
                                <option value="10681">存景</option>
                                <option value="10682">心念</option>
                                <option value="10683">露露</option>
                                <option value="10685">雨秋</option>
                                <option value="10686">陈静</option>
                                <option value="11381">张丹</option>
                                <option value="11382">雪也</option>
                                <option value="11402">宁芳</option>
                            </select>
                        </td>
                        <td>
                            <button class="btn btn-sm btn-success" id="addPickCourseButton" value="369661">保存</button>
                        </td>
                    </tr>
                    <script>
                    </script></tbody></table>

                </div>
            </div>
        </div>
    </div>
</div>
<!--客户跟踪隐藏层-->
<div class="modal" id="addFollowDiv" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" name="closeAddFollowDiv">×</button>
                <h4 class="modal-title">客户跟踪</h4>
            </div>
            <div class="modal-body">
                <input type="text" class="form-control input-sm" name="send_status" style="display:none">
                <form class="form-horizontal" id="follow_member">
                    <input class="form-control input-sm" name="member_id" id="addFollowCustomerId" style="display:none">
                    <div class="form-group">
                        <label class="col-lg-4 control-label">跟踪内容</label>
                        <div class="col-lg-8">
                            <textarea class="form-control input-sm" rows="3" name="followContent" id="followContentNotAlt">			</textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="" class="col-lg-4 control-label">跟踪日期</label>
                        <div class="col-lg-4">
                            <input class="form-control input-sm hasDatepicker" id="followDateNotAlt" name="followDate" value="2017-05-01">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">下次跟踪日期</label>
                        <div class="col-lg-4">
                            <input class="form-control input-sm hasDatepicker" id="nextFollowDateNotAlt" name="nextFollowDate">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-4 control-label">跟踪员工</label>
                        <div class="col-lg-4">
                                {:buildSelect('worker','worker_id','id','name')}
                        </div>
                    </div>
                </form></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal" name="closeAddFollowDiv">关闭</button>
                <button type="button" class="btn btn-primary btn-sm" id="addFollowBtn">保存</button>
            </div>

        </div>
    </div>

</div>
<!--会员开卡隐藏层-->
<div class="modal" id="open_card_div" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="close_open_card()">×</button>
                <h4 class="modal-title">开卡</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="{:U('add_kaika')}" id="add_kaika">
                    <input name="offset" value="" style="display:none">
                    <div class="form-group">
                        <label class="col-lg-2 control-label">会员卡号</label>
                        <div class="col-lg-6">
                            <input type="tel" class="form-control input-sm " name="card_no" autofocus="autofocus" >
                            <input style="display:none" name="card_typename">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">会员姓名</label>
                        <div class="col-lg-6">
                            <input style="display:none" name="cust_id">
                            <input type="text" class="form-control input-sm" name="cust_name" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">手机号码</label>
                        <div class="col-lg-6">
                            <input type="tel" class="form-control input-sm" name="cust_mobile" readonly="readonly">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">有效期限</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control input-sm" id="card_term" name="card_term" style="width:15em;display:inline" readonly="readonly">&nbsp;天
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">开卡日期</label>
                        <div class="col-lg-6">
                            <input id="open_card_begin_date" name="card_begin_date" class="form-control input-sm forui-datepicker-next ui-corner-all">

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">截止日期</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control input-sm forui-datepicker-next ui-corner-all" id="open_card_end_date" name="card_end_date">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">操作日期</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control input-sm forui-datepicker-next ui-corner-all" id="openDate" value="">
                        </div>
                    </div>
                </form></div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default btn-sm" data-dismiss="modal" onclick="close_open_card()">关闭</button>
                <button type="button" class="btn btn-primary btn-sm" id="openCardBtn">保存</button>
            </div>
        </div>

    </div>
</div>
<!--新增客户隐藏层-->
<div id="myTabContent" class="tab-content">
    <div class="tab-pane fade active in" id="profile">
        <!--新增客户-->
        <div id="setup" class="panel panel-success">
            <table class="table">
                <tbody><tr>
                    <td>
                        <form id="customer"  method="post">
                            <table style="width:100%;">

                                <input id="addCustomerId" type="hidden" value="">
                                <tbody><tr>
                                    <th style="text-align:right">姓名</th>
                                    <td style="padding:5px">
                                        <input id="addCustomerName" name="username" class="form-control input-sm necessery">
                                    </td>

                                    <th style="text-align:right">编号</th>
                                    <td style="padding:5px">
                                        <input id="addCustomerCode" name="code" class="form-control input-sm">
                                    </td>

                                </tr>
                                <tr>
                                    <th style="text-align:right">手机</th>
                                    <td style="padding:5px">
                                        <input id="addCustomerMobile" name="telphone" class="form-control input-sm necessery">
                                    </td>

                                    <th style="text-align:right">Email</th>
                                    <td style="padding:5px">
                                        <input id="addCustomerEmail" name="email" class="form-control input-sm">
                                    </td>

                                </tr>
                                <tr>
                                    <th style="text-align:right">性别</th>
                                    <td style="padding:5px">
                                        <select id="addCustomerGender" name="sex" class="form-control input-sm">
                                            <option value="女">女</option>
                                            <option value="男">男</option>
                                        </select>
                                    </td>

                                    <th style="text-align:right">微信/qq</th>
                                    <td style="padding:5px">
                                        <input id="addCustomerQQWX" name="weixinorqq" class="form-control input-sm">
                                    </td>

                                </tr>
                                <tr>
                                    <th style="text-align:right">积分</th>
                                    <td style="padding:5px">
                                        <input id="addCustomerPoints" name="jifen" class="form-control input-sm">
                                    </td>

                                    <th style="text-align:right">生日</th>
                                    <td style="padding:5px">
                                        <input id="addCustomerBirthday" name="birthday" class="form-control input-sm forui-datepicker-next ui-corner-all">
                                    </td>
                                </tr>

                                <tr>
                                    <th style="text-align:right">员工</th>
                                    <td style="padding:5px">
                                        <?php buildSelect('worker','worker_man','id','name'); ?>
                                    </td>

                                    <th style="text-align:right">来源</th>
                                    <td style="padding:5px">
                                        <select id="addCustomerSourceId" class="form-control input-sm">
                                            <option></option>
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <th style="text-align:right">地址</th>
                                    <td style="padding:5px">
                                        <input class="form-control input-sm" name="addr" id="address">
                                    </td>

                                    <th style="text-align:right">身份证</th>
                                    <td style="padding:5px">
                                        <input class="form-control input-sm" name="shengfenzheng" id="passport">
                                    </td>
                                </tr>

                                <tr>
                                    <th style="text-align:right">级别</th>
                                    <td style="padding:5px">
                                        <select id="addCustomerCustomerLevelId" class="form-control input-sm">
                                            <option></option>
                                        </select>
                                    </td>

                                    <th style="text-align:right">教案</th>
                                    <td style="padding:5px">
                                        <select id="addDocumentId" class="form-control input-sm">
                                            <option></option>
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <th style="text-align:right">介绍人</th>
                                    <td style="padding:5px">
                                        <input name="intro_man" class="form-control input-sm ui-autocomplete-input" id="introducerId">
                                        * 输入姓名、手机或卡号后选择<br>
                                        * 只有售卡时才会添加介绍人积分
                                    </td>

                                    <th style="text-align:right">备注</th>
                                    <td style="padding:5px">
                                        <textarea id="addCustomerCustomer_note" name="comment" class="form-control input-sm" rows="3"></textarea>
                                    </td>

                                </tr>

                                <tr>
                                    <th style="text-align:right">客户需求</th>
                                    <td style="padding:5px">
                                        <textarea class="form-control input-sm" name="requirement" id="joinpurpose" rows="3"></textarea>
                                    </td>
                                    <th style="text-align:right">类型</th>
                                    <td style="padding:5px">
                                        <select id="customertypeid" class="form-control input-sm">
                                            <option>请选择</option>
                                        </select>
                                    </td>
                                </tr>

                                <tr>
                                    <th style="text-align:right"></th>
                                    <td style="padding:5px"><button type="button" class="btn btn-sm btn-success" id="addCustomerBtn" buttonlist="9">保存</button> </td>
                                </tr>

                                </tbody></table>
                    <td style="width:25%;">
                        <span>会员肖像照片</span><br>
                        <img src="" style="max-width:200px; height:auto" name="face" id="faceImg">
                    <form id="logo" action="{:U('Admin/Member/uploadsLogo')}" method="POST"  enctype="multipart/form-data">
                        <input type="text" name="id" style="display:none">
                        <input type="file" name="face" size="3" >
                        <button type="submit" class="btn btn-xs btn-primary">上传图片</button>
                    </form>
                    </td>

                </tr>
                </tbody></table>
            </form>
        </div>
    </div>
    <div class="tab-pane fade" id="cardinfo" style="font-size:1em">
        <table class="table table-striped table-condensed">
            <!--第一行基本信息-->
            <tbody><tr>
                <td style="text-align:right">现在卡种名称</td><th style="text-align:left"><span name="card_typename_info">普通年卡</span></th>
                <td style="text-align:right">现在卡种类型</td><th style="text-align:left"><span name="cardtype_type_info">期限卡</span></th>
                <td style="text-align:right">首次销售日期</td><th style="text-align:left"><span name="sell_date_info"></span><button id="changecardselldate" buttonlist="9" class="btn btn-xs btn-default" data-toggle="modal" data-target="#changecardselldatemodal">修改</button></th>
                <td style="text-align:right">首次销售价格</td><th style="text-align:left"><span name="sell_price_info"></span>元</th>
            </tr>
            <!--第二行日期信息-->
            <tr>
                <td style="text-align:right">现在有效期限</td><th style="text-align:left"><span name="card_term_info"></span>天</th>
                <td style="text-align:right">首次买卡次数</td><th style="text-align:left"><span name="sellcard_times_info">0</span>次</th>
                <td style="text-align:right">现在开卡日期</td><th style="text-align:left"><span name="card_begin_date_info"></span></th>
                <td style="text-align:right">现在截止日期</td><th style="text-align:left"><span name="card_end_date_info"></span></th>
            </tr>
            <!--第三行次数信息-->
            <tr>
                <td style="text-align:right">总次数</td><th style="text-align:left"><span name="total_times_info">0</span>次</th>
                <td style="text-align:right">上课次数</td><th style="text-align:left"><span name="used_times_info">0</span>次</th>
                <td style="text-align:right">剩余次数</td><th style="text-align:left"><span name="left_times_info">0</span>次</th>
                <td style="text-align:right">储值余额</td><th style="text-align:left"><span name="card_saving_info">0</span></th>
            </tr>
            <!--第四行次数信息-->
            <tr>
                <td style="text-align:right">折扣率</td><th style="text-align:left"><span name="card_discount_info">1</span></th>
                <td style="text-align:right">售卡备注</td><th style="text-align:left" colspan="3"><span name="sellNote_info"></span></th>
                <td style="text-align:right">
                    <button class="btn btn-xs btn-success" id="printCardSell">打印小票</button>
                </td>
            </tr>
            </tbody></table>
    </div>
    <div class="tab-pane fade" id="changecardlist" style="font-size:1em" card="">
        <table class="table table-condensed">
            <tbody><tr>
                <th>升级日期</th>
                <th>老卡名称</th>
                <th>新卡名称</th>
                <th>新卡开始日期</th>
                <th>新卡截至日期</th>
                <th>升级前剩余次数</th>
                <th>升级后剩余次数</th>
                <th>升级新增次数</th>
                <th>升级后总次数</th>
                <th>新卡储值余额</th>
                <th>新卡折扣率</th>
                <th>升级金额</th>
                <th>升级备注</th>
                <th>操作</th>
            </tr>
            </tbody></table>

        <div class="modal fade" id="chagnechangemodal">
            <div class="modal-dialog">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                        <h4 class="modal-title">升级变更</h4>
                    </div>
                    <div class="modal-body">
                        <form class="form-horizontal">
                            <div class="form-group">
                                <label class="control-label col-lg-2">新开卡日期</label>
                                <div class="col-lg-4">
                                    <input class="form-control input-sm hasDatepicker" id="newcardbegindate">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="control-label col-lg-2">新截至日期</label>
                                <div class="col-lg-4">
                                    <input class="form-control input-sm hasDatepicker" id="newcardenddate">
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-primary" id="confirmchangechangebtn">确认</button>
                    </div>
                </div><!-- /.modal-content -->
            </div><!-- /.modal-dialog -->
        </div><!-- /.modal -->

        <script>
        </script>
    </div>
    <div class="tab-pane fade" id="delayList" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="stopcardlist" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="replacecardlist" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="booklist" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="checkinlist" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="cancellist" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="smslist" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="pointslist" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="coachcheckinlist" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="fitChecklist" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="handTagList" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="followList" style="font-size:1em">
        <table class="table table-condensed" id="follow_list">
            <tbody>
            <tr >
                <th>跟踪日期</th>
                <th>跟踪员工</th>
                <th>跟踪内容</th>
                <th>下次跟踪日期</th>
            </tr>
            </tbody>
        </table>
    </div>
    <div class="tab-pane fade" id="pickCourseList" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="addCardSavingList" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="productSellList" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="fixEnrollList" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="owePayList" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
    <div class="tab-pane fade" id="cardCourseList" style="font-size:1em"><button class="btn btn-sm btn-success" id="buyCardCourse" data-toggle="modal" data-target="#buyCardCourseModal" card="600017" customerid="369619">购买分类</button>
        <table class="table table-condensed" id="tablePickCourseList">
            <tbody><tr>
                <th>分类名称</th>
                <th>总次数</th>
                <th>剩余次数</th>
                <th>开始日期</th>
                <th>截止日期</th>
                <th>选课金额</th>
                <th>支付方式</th>
                <th>销售员工</th>
                <th>管理</th>
            </tr>
            </tbody></table>
        <script>

        </script>
    </div>
    <div class="tab-pane fade" id="profileList" style="font-size:1em">
        <p>请在上面列表里选择客户</p>
    </div>
</div>

<!--会员延期-->
<div class="modal" id="yanqi_card_div" style="display: none;">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="close_open_card()">×</button>
                <h4 class="modal-title">延迟</h4>
            </div>
            <div class="modal-body">
                <form class="form-horizontal" action="{:U('add_kaika')}" id="yanchi_kaika">
                    <input name="offset" value="" style="display:none">
                    <div class="form-group">
                        <label class="col-lg-2 control-label">会员卡号</label>
                        <div class="col-lg-6">
                            <input type="tel" class="form-control input-sm " name="card_no" autofocus="autofocus" >
                            <input style="display:none" name="card_typename">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">会员姓名</label>
                        <div class="col-lg-6">
                            <input style="display:none" name="cust_id">
                            <input type="text" class="form-control input-sm" name="cust_name" readonly="readonly">
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-lg-2 control-label">手机号码</label>
                        <div class="col-lg-6">
                            <input type="tel" class="form-control input-sm" name="cust_mobile" readonly="readonly">
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">有效期限</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control input-sm card_term" id="" name="card_term" style="width:15em;display:inline" readonly="readonly">&nbsp;天
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">开卡日期</label>
                        <div class="col-lg-6">
                            <input name="card_begin_date" class="form-control input-sm forui-datepicker-next ui-corner-all open_card_begin_date">

                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">截止日期</label>
                        <div class="col-lg-6">
                            <input type="text" class="form-control input-sm forui-datepicker-next ui-corner-all open_card_end_date" name="card_end_date">
                        </div>
                    </div>

                    <!--<div class="form-group">-->
                        <!--<label class="col-lg-2 control-label">操作日期</label>-->
                        <!--<div class="col-lg-6">-->
                            <!--<input type="text" class="form-control input-sm forui-datepicker-next ui-corner-all" id="" value="">-->
                        <!--</div>-->
                    <!--</div>-->
                </form></div>
            <div class="modal-footer">

                <button type="button" class="btn btn-primary btn-sm" id="yanchiCardBtn">保存</button>
            </div>
        </div>

    </div>
</div>

<!--会员售卡-->
<div class="modal" id="sell_card_div">
    <div class="modal-dialog">
        <div class="modal-content" style="width:120%">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true" onclick="close_sell_card()">×</button>
                <h4 class="modal-title">售卡</h4>
            </div>
            <div class="modal-body">
                <form id="sellCardForm" action="{:U('sell_user_card')}" class="form-horizontal">
                    <input name="offset" value="" style="display:none">
                    <div class="form-group">
                        <label class="col-lg-2 control-label">会员卡号</label>
                        <div class="col-lg-4">
                            <input type="tel" class="form-control input-sm" id="new_card_no" name="card_no" autofocus="autofocus" placeholder="必填"><div id="duplicate"></div>
                        </div>
                        <label for="select" class="col-lg-2 control-label">选择卡项</label>
                        <div class="col-lg-4">
                            <select id="card_type" name="card_type" class="form-control input-sm">
                                <option value="0">请选择</option>
                                <volist  name="card" id="v">
                                    <option value="{$v.id}">{$v.name}</option>
                                </volist>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">会员姓名</label>
                        <div class="col-lg-4">
                            <input style="display:none" name="cust_id" id="sellCardCustId">
                            <input type="text" class="form-control input-sm" name="cust_name" id="sellCardCustName">
                        </div>
                        <label class="col-lg-2 control-label">手机号码</label>
                        <div class="col-lg-4">
                            <input type="tel" class="form-control input-sm" name="cust_mobile" id="sellCardCustMobile"><div id="mobile_duplicate"></div>
                        </div>
                    </div>



                    <div class="form-group">
                        <label class="col-lg-2 control-label">有效期限</label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control input-sm" id="card_terms" name="card_term" style="width:15em;display:inline" readonly="">&nbsp;天
                        </div>
                        <label class="col-lg-2 control-label">有效次数</label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control input-sm" id="card_times" name="card_times" style="width:15em;display:inline">&nbsp;次
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">储值金额</label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control input-sm" id="card_saving" name="card_saving" style="width:15em;display:inline">&nbsp;
                        </div>
                        <label class="col-lg-2 control-label">折扣率</label>
                        <div class="col-lg-4">
                            <input type="text" class="form-control input-sm" id="card_discount" name="card_discount" style="width:15em;display:inline">&nbsp;
                        </div>
                    </div>

                    <div class="form-group" id="sellardShouldPay">
                        <label class="col-lg-2 control-label">应收金额</label>
                        <div class="col-lg-6">
                            <input type="tel" class="form-control input-sm" id="card_price" name="card_price" style="width:15em;display:inline">&nbsp;元
                        </div>
                        <div class="col-lg-2" style="padding-left:0;padding-right:0">
                            <input type="radio" id="sellCardPayRadio" name="sellCardPayRadio" style="margin-left:0">分期缴费
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">购卡积分</label>
                        <div class="col-lg-4">
                            <input type="tel" class="form-control input-sm" id="card_points" name="card_points" value="0" style="width:15em;display:inline">
                        </div>
                        <label class="col-lg-2 control-label">支付方式</label>
                        <div class="col-lg-4">
                            <select name="pay_way" class="form-control input-sm" id="sellCardPayWay">
                                <option value="cash">现金</option>
                                <option value="bank">银行卡</option>
                                <option value="alipay">支付宝</option>
                                <option value="wxpay">微信支付</option>
                                <option value="saving">储值</option>
                                <option value="points">积分</option>
                            </select>
                        </div>
                    </div>

                    <div class="form-group">
                        <label class="col-lg-2 control-label">销售备注</label>
                        <div class="col-lg-6">
                            <textarea name="sellNote" id="sellNote" class="form-control input-sm" rows="2">				</textarea>
                        </div>
                    </div>

                </form></div>
            <div class="modal-footer">
                <!--<button type="button" class="btn btn-default btn-sm" data-dismiss="modal" onclick="close_sell_card()">关闭</button>-->
                <button type="button" class="btn btn-primary btn-sm" id="sellCardSaveButton" >保存</button>
            </div>
        </div>

    </div>
</div>
<!---->
<script type="text/javascript" charset="utf-8" src="__PUBLIC__/Admin/jquery.table2excel.js"></script>


<script>

    $(document).ready(function() {
        $("#btn").click(function(){
            $(".table2excel").table2excel({
                exclude: ".noExl",
                name: "Excel Document Name",
                filename: "会员列表",
                exclude_img: true,
                exclude_links: true,
                exclude_inputs: true
            });
        });
        $("#yanchiCardBtn").click(function () {
            $("#yanchi_kaika").submit();
        })
        $("#sellCardSaveButton").click(function () {
            $("#sellCardForm").submit();
        })
        $("#card_type").change(function () {

            $.post('{:U(card_type)}',{id:$('#card_type').val() },function (res) {
                $("#card_terms").val('0');
                $("#card_terms").val(res);

            },"json");
        })
    });

    function active_yanqi() {
        var member=$("#member_id").val();

        if(member) {
            $.post('{:U(get_card_data)}',{id:member },function (res) {
                $(".card_term").val(res.effective_day);
                $(".open_card_begin_date").val(res.start_time);
                $(".open_card_end_date").val(res.end_time);
            },"json");

            $("#yanqi_card_div").show();
        }else{
            layer.msg('请先选择会员！',{icon:2});
            return false;
        }
    }

    function sell_card() {
        $("#sell_card_div").show();
    }
</script>

<script>
    $(document).ready(function () {
        $(".close").click(function () {
            $(this).parent("div").parent("div").parent("div").parent("div").hide();
        })
    });
    $(function(){
        $( "#addCustomerBirthday" ).datepicker({
            changeMonth: true,
            changeYear: true
        });
       $("#openDate").datepicker();

        $("#followDateNotAlt").datepicker();
        $('#open_card_begin_date').datepicker();
        $('#open_card_end_date').datepicker();
        $('.open_card_begin_date').datepicker();
        $('.open_card_end_date').datepicker();

        $(".open_card_end_date,.open_card_begin_date").change(function () {
            $(".card_term").val(DateDiff($('.open_card_begin_date').val(), $(".open_card_end_date").val()));
        })
        $("#open_card_end_date,#open_card_begin_date").change(function () {
            $("#card_term").val(DateDiff($('#open_card_begin_date').val(), $("#open_card_end_date").val()));
        })

        $("#openCardBtn").click(function () {
            $("#add_kaika").submit();
        })
    });
    function DateDiff(sDate1, sDate2) {  //sDate1和sDate2是yyyy-MM-dd格式



        var aDate, oDate1, oDate2, iDays;

        aDate = sDate1.split("-");

        oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);  //转换为yyyy-MM-dd格式

        aDate = sDate2.split("-");

        oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]);

        iDays = parseInt(Math.abs(oDate1 - oDate2) / 1000 / 60 / 60 / 24); //把相差的毫秒数转换为天数



        return iDays;  //返回相差天数

    }
    //选中变为选中状态
    $("#customerTable").find("tr[id^='member_']").click(function(){
        var id =$(this).attr('data-id');
        var data ={
            'id':id
        };
        $(this).addClass("s1").siblings().removeClass("s1");
        $.post("{:U('getMemberById')}",data,function (res) {
            if(res['status'] == 'success'){
                $("table[id='follow_list']   tr:not(:first)").empty("");
                var info_data = res['data'];
                var follow_data = res['follow_data'];
                $("#pointsName").val(info_data.username);
                $("#addCustomerId").val(info_data.id);
                $("#member_id").val(info_data.id);
                $(".member_id").val(info_data.id);
                $("#oldCardSaving").val(info_data.member_account);
                $("#addCustomerName").val(info_data.username);
                $("#addCustomerCode").val(info_data.code);
                $("#addCustomerMobile").val(info_data.telphone);
                $("#addCustomerBirthday").val(info_data.birthday);
                $("#addCustomerPoints").val(info_data.jifen);
                $("#passport").val(info_data.shengfenzheng);
                $("#addCustomerGender").val(info_data.sex);
                $("#addCustomerCustomer_note").val(info_data.comment);
                info_data.requirement = undefined;
                $("#joinpurpose").val(info_data.requirement);
                $("#faceImg").attr('src',"/Public/Uploads/"+info_data.face);
                $("input[name='id']").val(info_data.id);
                $("input[name='member_id']").val(info_data.id);
                $("input[name='card_no']").val(info_data.kahao);
                $("input[name='cust_name']").val(info_data.username);
                $("input[name='cust_mobile']").val(info_data.telphone);

                //跟踪记录
                console.log(follow_data);
                var table =$("table[id='follow_list']");
                for(var i=0;i<follow_data.length;i++){
                    var tr = '<tr>'+'<td>'+follow_data[i].followdate+'</td>'+'<td>'+follow_data[i].worker_id+'</td>'+'<td>'+follow_data[i].nextfollowdate+'</td>'+'<td>'+follow_data[i].followcontent+'</td>'+'</tr>';
                    table.append(tr);
                }


            }else{
                layer.msg(res['msg']);
            }
        },"json");
    });


    //加减积分
  $("#points_manage").click(function () {
      var member=$("#member_id").val();

      if(member){
          $("#points_manage_div").show();
      }
      if(member == ''){
          layer.msg('请先选择会员！',{icon:2});
          return false;
      }
  });
    $(".cancel").click(function () {
        $("#points_manage_div").hide();
    });
    $("#pointsManageBtn").click(function () {
        var data = $("form[id='points']").serialize();
        $.post("{:U('changePoints')}",data,function (res) {
            if(res['status'] == 'success'){
                layer.msg(res['msg']);
            }else{
                layer.msg(res['msg']);
            }
            $("#points_manage_div").hide();
            setInterval('window.location.reload()',3000);
        });
    });
    //账户充值
    $("#addCardSavingNums").change(function () {
        var data = parseInt($("#oldCardSaving").val());
        var new_data = data+parseInt($("#addCardSavingNums").val());
        $("#newCardSaving").val(new_data);
    });
    $("#addCardSavingBtn").click(function () {
        var data = $("form[id='addCardSavingForm']").serialize();
        if(data){
            $.post("{:U('changeAccount')}",data,function (res) {
                if(res['status'] == 'success'){
                    layer.msg(res['msg']);
                }else{
                    layer.msg(res['msg']);
                }
                $("#addCardSavingDiv").hide();
                setInterval('window.location.reload()',3000);
            });
        }else{
            layer.msg('请先选择会员！');
        }

    });
    //购买私教

    //开卡
    function open_card() {
        var member=$("#member_id").val();

        if(member) {
            $.post('{:U(get_course)}',{id:member },function (res) {
                $("#card_term").val(res);
            },"json");

            $("#open_card_div").show();
        }else{
            layer.msg('请先选择会员！',{icon:2});
            return false;
        }
    }
    function close_open_card() {
        $("#open_card_div").hide();
    }
    $(".hasDatepicker").click(function () {

    });

    //修改会员资料
    $("#addCustomerBtn").click(function () {
        var data = $("#customer").serialize();
        console.log(data);
        $.post('editOrAdd',data,function (res) {
            if(res['status'] == 'success'){
                layer.msg(res['msg'],{icon:1});
            }else{
                layer.msg(res['msg'],{icon:2});
            }
        },"json");
    });

    //跟踪记录
    $("#addFollowBtn").click(function () {
        if($("input[name='id']").val()){
            var data = $("#follow_member").serialize();
            $.post("{:U(followMemberRecord)}",data,function (res) {
                if(res['status'] == 'success'){
                    layer.msg(res['msg'],{icon:1});
                }else{
                    layer.msg(res['msg'],{icon:2});
                }
            },"json");
        }else{
            layer.msg('请先选择会员！',{icon:2});
        }

    });
</script>